<%@page import="classes.User"%>
<%@page import="classes.AccountManager"%>
<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Admin Main Page</title>
</head>
<body>

<%

	out.println("<form action=\"addUser.html\" method=\"post\">");
	out.println("<input type=submit value=addUser>");
	out.println("</form>");
	out.println("<br> <br>");
	
	
	

	AccountManager accManager = (AccountManager)application.getAttribute(AccountManager.ACCOUNTMANAGER);
	out.println("Admin users <br>");
	User[] users = accManager.getUsersByStatus("0");
	if(users != null){
		out.println("<form action=\"redirecting.jsp?\" method=\"get\">");
		out.println("<SELECT NAME=\"user\" SIZE=\"4\" >");
		for(int i=0; i<users.length; i++){
			out.println("<OPTION> " + users[i].getUserName() + " " + users[i].getName() + " " + users[i].getSurName());
		}
		out.println("</SELECT>");
		out.println("<input type=submit value=edit name=action>");
		out.println("<input type=submit value=remove name=action>");
		out.println("</form>");

	}
	else{
		out.println("<form action=\"addUser.html\" method=\"post\">");
		out.println("no user");
		out.println("<input type=submit value=addUser>");
		out.println("</form>");
		out.println("<br>");
		out.println("<br>");
		out.println("<br>");
	}
	
	
	out.println("<br> Lecturer users <br>");
	users = accManager.getUsersByStatus("1");
	if(users != null){
		out.println("<form action=\"redirecting.jsp\" method=\"post\">");
		out.println("<SELECT NAME=\"user\" SIZE=\"4\" >");
		for(int i=0; i<users.length; i++){
			out.println("<OPTION> " + users[i].getUserName() + " " + users[0].getName() + " " + users[i].getSurName());
		}
		out.println("</SELECT>");
		out.println("<input type=submit value=edit name=action>");
		out.println("<input type=submit value=remove name=action>");
		out.println("</form>");
	}
	else{
		out.println("<form action=\"addUser.html\" method=\"post\">");
		out.println("no user");
		out.println("<input type=submit value=addUser>");
		out.println("</form>");
		out.println("<br>");
		out.println("<br>");
		out.println("<br>");
	}

	out.println("<br> Student users <br>");
	users = accManager.getUsersByStatus("3");
	if(users != null){
		out.println("<form action=\"redirecting.jsp\" method=\"post\">");	
		out.println("<SELECT NAME=\"user\" SIZE=\"4\"  >");
		
		for(int i=0; i<users.length; i++){
			out.println("<OPTION> " + users[i].getUserName() + " " + users[0].getName() + " " + users[i].getSurName());
		}
		
		out.println("</SELECT>");
		out.println("<input type=submit value=edit name=action>");
		out.println("<input type=submit value=remove name=action>");
		out.println("</form>");
		
	}
	else{
		out.println("<form action=\"addUser.html\" method=\"post\">");
		out.println("no user");
		out.println("<input type=submit value=addUser>");
		out.println("</form>");
		out.println("<br>");
		out.println("<br>");
		out.println("<br>");
		
	}
	
	


%>

<a href="subjects.jsp">Subjects</a>
<P>
<a href="AccountSettings.jsp">Account Settings</a>
</P>
</body>
</html>